import request from '@/plugin/axios'
import util from '@/libs/util.js'

export default {

	list (data) {
		return request({
			url: 'rateGroup/list',
			headers: {},
			method: 'post',
			data,
		});
	},

	info (data) {
		return request({
			url: 'rateGroup/get',
			headers: {},
			method: 'post',
			data,
		});
	},

	add (data) {
		return request({
			url: 'rateGroup/add',
			headers: {},
			method: 'post',
			data,
		});
	},

	set (data) {
		return request({
			url: 'rateGroup/edit',
			headers: {},
			method: 'post',
			data,
		});
	},

	del (data) {
		return request({
			url: 'rateGroup/del',
			headers: {},
			method: 'post',
			data,
		});
	},

	async getOptions () {
		
		var re = await this.list({search: {status: 1}, page: 1, limit: Number.MAX_SAFE_INTEGER});
		var options = [];

		re.list.forEach(item => {
			options.push({label: item.name, value: item.id});
		});

		return options;

	},

	option (data) {
		return request({
			url: 'rateGroup/option',
			headers: {},
			method: 'post',
			data,
		});
	},

};